Skip to content

Add the environment variable CLAUDE_CODE_SKIP_PREFLIGHT_CHECK=1 to allow access in China and Hong Kong.#27

Open
Named1ess wants to merge 4 commits intopaoloanzn:mainfrom
Named1ess:main
Open

Add the environment variable CLAUDE_CODE_SKIP_PREFLIGHT_CHECK=1 to allow access in China and Hong Kong.#27
Named1ess wants to merge 4 commits intopaoloanzn:mainfrom
Named1ess:main

Conversation

@Named1ess
Copy link
Copy Markdown

@Named1ess Named1ess commented Apr 7, 2026

Add the environment variable CLAUDE_CODE_SKIP_PREFLIGHT_CHECK=1 to allow access in China and Hong Kong.

Summary by CodeRabbit

  • Chores
    • Added environment variable configuration to optionally bypass preflight connectivity checks during initialization.

…low use in China and Hong Kong.

Add the environment variable CLAUDE_CODE_SKIP_PREFLIGHT_CHECK=1 to allow use in China and Hong Kong.
Add a comment.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

Added conditional bypass logic to preflight connectivity checks in the utilities module. When the CLAUDE_CODE_SKIP_PREFLIGHT_CHECK environment variable is truthy, checkEndpoints() returns immediate success and _temp() early-returns, skipping OAuth endpoint validation, HTTP requests, and exit behavior.

Changes

Cohort / File(s) Summary
Preflight Check Bypass
src/utils/preflightChecks.tsx
Added environment variable-driven early returns in checkEndpoints() and _temp() functions to skip connectivity checks when CLAUDE_CODE_SKIP_PREFLIGHT_CHECK is enabled.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 With a whisker-twitch and a hoppy skip,
We bypass the checks with a simple flip,
Env vars grant us passage swift,
No endpoints to validate—what a gift!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding an environment variable to bypass preflight checks for regional access. It's specific, clear, and directly corresponds to the code modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/utils/preflightChecks.tsx (1)

19-21: Centralize the skip-flag check (and optionally emit a “preflight skipped” event).

The same env key and condition are duplicated in checkEndpoints() and _temp(). Extract a shared constant/helper to avoid drift, and consider logging a dedicated skip event for observability.

♻️ Suggested refactor
+const SKIP_PREFLIGHT_ENV = 'CLAUDE_CODE_SKIP_PREFLIGHT_CHECK';
+const shouldSkipPreflight = () => isEnvTruthy(process.env[SKIP_PREFLIGHT_ENV]);

 async function checkEndpoints(): Promise<PreflightCheckResult> {
-  if (isEnvTruthy(process.env.CLAUDE_CODE_SKIP_PREFLIGHT_CHECK)) { //Bypasses preflight checks if the environment variable is set.
-    return { success: true }; //return true
+  if (shouldSkipPreflight()) {
+    // Optional: logEvent('tengu_preflight_check_skipped', { env: SKIP_PREFLIGHT_ENV });
+    return { success: true };
   }

 function _temp() {
-  if (isEnvTruthy(process.env.CLAUDE_CODE_SKIP_PREFLIGHT_CHECK)) {
-    return;// Skip preflight checks if the corresponding environment variable is enabled.
+  if (shouldSkipPreflight()) {
+    return;
   }
   return process.exit(1);
 }

Also applies to: 153-155

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/preflightChecks.tsx` around lines 19 - 21, Extract the duplicated
environment check into a single exported helper (e.g., const SKIP_PREFLIGHT_ENV
= 'CLAUDE_CODE_SKIP_PREFLIGHT_CHECK' and function shouldSkipPreflight() that
calls isEnvTruthy(process.env[SKIP_PREFLIGHT_ENV])) and replace the inline
checks in the current file and in checkEndpoints() and _temp() to call
shouldSkipPreflight(); also emit or log a single "preflight skipped"
observability event from that helper (or have it call a provided logger/emitter)
so all callers get a consistent skip message.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/utils/preflightChecks.tsx`:
- Around line 19-21: Extract the duplicated environment check into a single
exported helper (e.g., const SKIP_PREFLIGHT_ENV =
'CLAUDE_CODE_SKIP_PREFLIGHT_CHECK' and function shouldSkipPreflight() that calls
isEnvTruthy(process.env[SKIP_PREFLIGHT_ENV])) and replace the inline checks in
the current file and in checkEndpoints() and _temp() to call
shouldSkipPreflight(); also emit or log a single "preflight skipped"
observability event from that helper (or have it call a provided logger/emitter)
so all callers get a consistent skip message.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a5283777-9836-4aee-bd8a-fa96c53c5652

📥 Commits

Reviewing files that changed from the base of the PR and between 7dc15d6 and bb40e9e.

📒 Files selected for processing (1)
  • src/utils/preflightChecks.tsx

@brrock
Copy link
Copy Markdown

brrock commented Apr 7, 2026

LGTM, agree with the cr nitpicks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants